﻿Imports System.Data.OleDb

Partial Class admin_AdminCategories
    Inherits System.Web.UI.Page

    Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        
    End Sub

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Dim accessCon As New OleDbConnection(ConfigurationManager.ConnectionStrings("GotPinkDB").ConnectionString)
        accessCon.Open()

        Dim sql As String = "INSERT INTO Category (CategoryName, CategoryDesc, IsVisible) VALUES (@CatName, @CatDesc, @IsVisible)"
        Dim cmd As New OleDbCommand(sql, accessCon)
        Try
            cmd.Parameters.AddWithValue("@CatName", txtCatName.Text)
            cmd.Parameters.AddWithValue("@CatDesc", txtCatDesc.Text)
            cmd.Parameters.AddWithValue("@IsVisible", chkIsVisible.Checked)
            cmd.ExecuteNonQuery()

        Catch ex As Exception

        Finally
            cmd.Dispose()
            accessCon.Close()
        End Try
        grvCategoriesView.DataBind()
    End Sub

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnAddNew_Click(sender As Object, e As System.EventArgs) Handles btnAddNew.Click
       
    End Sub
End Class
